from django.db import models

# Create your models here.
class User(models.Model):
    username = models.CharField(max_length=50,unique=True)
    email = models.EmailField(unique=True)
    password = models.CharField(max_length=18)
    class Meta():
        db_table = 'user'
        verbose_name_plural = '用户表'
    def __str__(self):
        return self.username


class Post(models.Model):
    title = models.CharField(max_length=200)
    content = models.CharField(max_length=300)
    user = models.ForeignKey(User,on_delete=models.CASCADE,related_name='stu')
    time = models.TimeField(null=True)
    class Meta():
        db_table = 'post'
        verbose_name_plural = '发布表'

    def __str__(self):
        return self.title



